home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / haeberli / impression / ssgen.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  78 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    ssgen - 
  19.  *        Generate a set of sample positions.
  20.  *
  21.  *            Paul Haeberli - 1988
  22.  */
  23. #include "stdio.h"
  24. #include "ss.h"
  25. #include "math.h"
  26.  
  27. main(argc,argv)
  28. int argc;
  29. char **argv;
  30. {
  31.     sampleset *oss;
  32.     int xsize, ysize;
  33.  
  34.     if( argc<4 ) {
  35.     fprintf(stderr,"usage: ssgen out.ss xsize ysize\n");
  36.     exit(1);
  37.     } 
  38.     xsize = atoi(argv[2]);
  39.     ysize = atoi(argv[3]);
  40.     oss = ssnew();
  41.     ssgen(oss,xsize,ysize);
  42.     sstofile(argv[1],oss);
  43. }
  44.  
  45. ssgen(oss,xsize,ysize)
  46. sampleset *oss; 
  47. int xsize, ysize;
  48. {
  49.     sample *ns;
  50.     float xpos, ypos;
  51.     int x, y;
  52.  
  53.     for(y=0; y<ysize; y++) {
  54.     for(x=0; x<xsize; x++) {
  55.         xpos = x/(xsize-1.0);
  56.         ypos = y/(ysize-1.0);
  57.         ns = (sample *)malloc(sizeof(sample));
  58.         ns->xpos = POSSCALE*xpos;
  59.         ns->ypos = POSSCALE*ypos;
  60.         ns->r = 0;
  61.         ns->g = 0;
  62.         ns->b = 0;
  63.         ns->a = 0;
  64.         ns->SAMPLE_SIZE = 60;
  65. #ifdef SDFSD
  66.         if(y&1)
  67.         ns->SAMPLE_DIR = -256/8;
  68.         else
  69.         ns->SAMPLE_DIR = 256/8;
  70. #endif
  71.         ns->SAMPLE_DIR = -256/8;
  72.         ns->SAMPLE_SHAPE = FINELINES;
  73.         addsample(oss,ns);
  74.     }
  75.     }
  76. }
  77.  
  78.